package org.example;

public class Main {
    public static void main(String[] args) {
        Thread aa = new Thread(()->{
            System.out.println(Thread.currentThread().getName()+"::"+Thread.currentThread().isDaemon());
            while(true){
                System.out.println("hello");
                try {
                    Thread.sleep(200);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });
        aa.setDaemon(true);
        aa.start();

        try {
            Thread.sleep(20);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println(Thread.currentThread().getName()+" is over");
        //主线程结束，用户线程存在，jvm存活

    }
}